package com.hl.sfzy.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hl.sfzy.entity.ChargeType;
import com.hl.sfzy.service.ChargeTypeService;
import com.hl.sfzy.mapper.ChargeTypeMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ChargeTypeServiceImpl implements ChargeTypeService {
    @Autowired
    private ChargeTypeMapper chargeTypeMapper;
    @Override
    public long insert(ChargeType chargeType) {
        return chargeTypeMapper.insert(chargeType);
    }

    @Override
    public long deleteByPrimaryKey(long id) {
        return chargeTypeMapper.deleteByPrimaryKey(id);
    }

    @Override
    public long update(ChargeType chargeType) {
        return chargeTypeMapper.update(chargeType);
    }

    @Override
    public  List<ChargeType> selectByPrimaryKey(long id) {
        return chargeTypeMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<ChargeType> selectAll() {
        return chargeTypeMapper.selectAll();
    }
    @Override
    public PageInfo<ChargeType> findByPage(int pageNum, int pageSize, ChargeType chargeType) {
        PageHelper.startPage(pageNum, pageSize);
        List<ChargeType> chargeTypes = chargeTypeMapper.selectAll();
        PageInfo<ChargeType> pageInfo = new PageInfo<>(chargeTypes);
        return pageInfo;
    }
}
